package cn.iocoder.yudao.module.blog.dal.mysql.follow;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.blog.controller.app.follow.vo.AppBlogFollowPageReqVO;
import cn.iocoder.yudao.module.blog.dal.dataobject.follow.BlogFollowDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.blog.controller.admin.follow.vo.*;

/**
 * 关注 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface BlogFollowMapper extends BaseMapperX<BlogFollowDO> {

    default PageResult<BlogFollowDO> selectPage(BlogFollowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogFollowDO>()
                .eqIfPresent(BlogFollowDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(BlogFollowDO::getFollowMemberId, reqVO.getFollowMemberId())
                .orderByDesc(BlogFollowDO::getId));
    }

    default List<BlogFollowDO> selectList(BlogFollowExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BlogFollowDO>()
                .eqIfPresent(BlogFollowDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(BlogFollowDO::getFollowMemberId, reqVO.getFollowMemberId())
                .orderByDesc(BlogFollowDO::getId));
    }

    default PageResult<BlogFollowDO> selectPage(AppBlogFollowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogFollowDO>()
                .eqIfPresent(BlogFollowDO::getMemberId, reqVO.getMemberId())
                .orderByDesc(BlogFollowDO::getId));
    }

}
